#ifndef KBestParseForest2OGrandChildren_H
#define KBestParseForest2OGrandChildren_H
#include"ParseForestItem.h"
#include"KBestParseForest.h"

class KBestParseForest2OGrandChildren : public KBestParseForest{
protected:
	virtual int getKey(int g, int s, int t, int dir, int comp, int k);

	virtual int getI(int i, int c, int k);

	virtual vector<pair<FeatureVector*, string*> >* getBestParses_strict(DependencyInstance *inst, DependencyPipe *pipe, vector<vector<vector<double> > > &probs,
		vector<vector<vector<vector<double> > > > &nt_probs, bool labeled);

	virtual vector<pair<FeatureVector*, string*> >* getBestParses_normal(DependencyInstance *inst, DependencyPipe *pipe, vector<vector<vector<double> > > &probs,
		vector<vector<vector<vector<double> > > > &nt_probs, bool labeled);
public:
	KBestParseForest2OGrandChildren();

	KBestParseForest2OGrandChildren(int start, int end, DependencyInstance &inst, int K);

	virtual string* getDepString(ParseForestItem &pfi);

	bool add(int g, int s, int type, int dir, double score);

	bool add(int g, int s, int r, int t, int type, int dir, int comp, double score, ParseForestItem *p1, ParseForestItem *p2);

	bool add_output(ParseForestItem *output, int r, int t, int type, int comp, double score, ParseForestItem *p1, ParseForestItem *p2);

	double getProb(int g, int s, int t, int dir, int comp);
	
	double getProb(int g, int s, int t, int dir, int comp, int i);
	
	vector<double>* getProbs(int g, int s, int t, int dir, int comp);
	
	ParseForestItem getItem(int g, int s, int t, int dir, int comp);
	
	ParseForestItem getItem(int g, int s, int t, int dir, int comp, int k);
	
	ParseForestItem* getItems(int g, int s, int t, int dir, int comp);
	
	
	virtual vector<pair<FeatureVector*, string*> >* getBestParses(DependencyInstance *inst, DependencyPipe *pipe, vector<vector<vector<double> > > &probs,
		vector<vector<vector<vector<double> > > > &nt_probs, bool labeled, bool normal);

	virtual ~KBestParseForest2OGrandChildren();
};
#endif
